package service;

import java.util.*;

import beans.*;
import db.*;


public class applicationService {
	
	public List<applicationBean> browse(){
		applicationDAO dao =new applicationDAO();
		return dao.getAllRecords();
	}
	
	public boolean addapplication(applicationBean application)
	{
		applicationDAO applicationDao=new applicationDAO();
		return applicationDao.insertRecord(application);
	}
	
	public applicationBean getRecord(String docid,int schid)
	{
		applicationDAO applicationDao=new applicationDAO();
		return applicationDao.getRecord(docid,schid);
	}
	
	public int delapplication(applicationBean application)
	{
		applicationDAO applicationDao=new applicationDAO();
		if(applicationDao.deleteRecord(application))
			return 1;
		else
			return 2;
	}
	
	public int updateapplication(applicationBean beforeRecord,applicationBean afterRecord)
	{
		applicationDAO applicationDao=new applicationDAO();
		if(applicationDao.updateRecord(beforeRecord,afterRecord))
			return 1;
		else
			return 2;
	}
}
